function handle_balance () {
    $('#content').remove();
    const url = '/balance' + location.search;
    $.get(url, function (data) {
        const balance_html = `<div id="content" class="balance"><label>当前余额：</label>&ensp;<span>${data}</span></div>`
        $('.content').append(balance_html)
    })
}

function handle_copyright () {
    $('#content').remove();
    const url = '/copyright' + location.search;
    $.get(url, function (data) {
        let copyright = '';
        for (let i = 0; i < data.CRT_Set.length; i++) {
            copyright = copyright + `<tr><td>版权&nbsp;${i}</td><td>${data.CRT_Set[i]}</td></tr>`;
        }
        const copyright_html = '<div id="content"><label>版权列表</label><table class="am-table am-table-bordered am-table-radius am-table-striped">' + copyright + '</table></div>';
        $('.content').append(copyright_html);
    })
}

function handle_history () {
    $('#content').remove();
    const url = '/history' + location.search;
    $.get(url, function (data) {
        console.log(data);
        let history = '';
        for (let i = 0; i < data.his.length; i++) {
            history += `<tr><td>交易记录&nbsp;${i}</td><td>${data.his[i]}</td></tr>`;
        }
        const history_html = '<div id="content"><label>版权列表</label><table class="am-table am-table-bordered am-table-radius am-table-striped">' + history + '</table></div>';
        $('.content').append(history_html);
    })
}

$(document).ready(function () {
    handle_balance();
})